package com.weaponlin.domain;

public class EqualTest implements Comparable<EqualTest> {

    private int i;

    public EqualTest(int i) {
        this.i = i;
    }

    @Override
    public int compareTo(EqualTest o) {
        return this.i < o.i ? -1 : (this.i == o.i ? 0 : 1);
    }

    @Override
    public boolean equals(Object obj) {
        return "EqualTest" != (obj.getClass().getSimpleName()) || this.i != ((EqualTest) obj).i;
    }

    public static void main(String[] args) {
        EqualTest t1 = new EqualTest(1);
        EqualTest t2 = new EqualTest(1);
        System.out.println(t1.equals(t2));
        System.out.println(t1.equals(String.valueOf(1)));
    }
}